package com.zb.controller;


import com.zb.entity.vo.ServicePageSelectVo;
import com.zb.entity.vo.ServicePageVo;
import com.zb.result.Result;
import com.zb.service.ZjAdmServicePageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 总后台服务页面表 前端控制器
 * </p>
 *
 * @author WEN
 * @since 2023-10-31
 */
@Api(tags = "服务页面类接口")
@RestController
@RequestMapping("/servicePage")
public class ZjAdmServicePageController {
    @Resource
    private ZjAdmServicePageService admServicePageService;

    @ApiOperation("新增或修改服务页面")
    @PostMapping("/save")
    public Result save(@RequestBody @Valid ServicePageVo servicePageVo) {
        admServicePageService.save(servicePageVo);
        return Result.success(null == servicePageVo.getId()? "新增服务页面成功" : "修改服务页面成功");
    }

    @ApiOperation("获取服务页面列表")
    @PostMapping("/getList")
    public Result getList(@RequestBody ServicePageSelectVo selectVo) {
        return Result.success("获取服务页面列表成功").data(admServicePageService.getList(selectVo));
    }

    @ApiOperation("根据服务页面ID获取服务页面详情")
    @GetMapping("/getDetail/{id}")
    public Result getDetail(@PathVariable @ApiParam(value = "服务页面ID", required = true) Long id) {
        return Result.success("获取服务页面详情成功").data("row", admServicePageService.getDetail(id));
    }


}
